* Clean up
clear all

/* Set working directory: please set your own
cd "~/Dropbox/JOP third submission/JOP replication/"
*/

* Open dataset

use 01_data/cis_data.dta, clear

* Generate interactions
gen cabine_use_pp_dummy = cabine_use * pp_dummy
gen cabine_use_cs_dummy = cabine_use * cs_dummy
gen cabine_use_vox_dummy = cabine_use * vox_dummy
gen cabine_use_up_dummy = cabine_use * podemos_dummy
gen cabine_use_psoe_dummy = cabine_use * psoe_dummy

regr uncomfortable cabine_use pp_dummy cs_dummy vox_dummy podemos_dummy psoe_dummy ///
cabine_use_pp_dummy cabine_use_cs_dummy cabine_use_vox_dummy cabine_use_up_dummy cabine_use_psoe_dummy ///
, r
est store uncomf_nocontrols_all
estadd local Controls "No"
estadd local FE "No"

regr uncomfortable cabine_use pp_dummy cs_dummy vox_dummy podemos_dummy psoe_dummy ///
cabine_use_pp_dummy cabine_use_cs_dummy cabine_use_vox_dummy cabine_use_up_dummy cabine_use_psoe_dummy ///
i.CCAA, r
est store uncomf_fe_all
estadd local Controls "No"
estadd local FE "Yes"

regr uncomfortable cabine_use pp_dummy cs_dummy vox_dummy podemos_dummy psoe_dummy ///
cabine_use_pp_dummy cabine_use_cs_dummy cabine_use_vox_dummy cabine_use_up_dummy cabine_use_psoe_dummy ///
female i.income i.TAMUNI age age_sq i.education, r
est store uncomf_controls_all
estadd local Controls "Yes"
estadd local FE "No"

regr uncomfortable cabine_use pp_dummy cs_dummy vox_dummy podemos_dummy psoe_dummy ///
cabine_use_pp_dummy cabine_use_cs_dummy cabine_use_vox_dummy cabine_use_up_dummy cabine_use_psoe_dummy ///
female i.income i.TAMUNI age age_sq i.education i.CCAA, r
est store uncomf_fe_controls_all
estadd local Controls "Yes"
estadd local FE "Yes"


* Make table
esttab uncomf_nocontrols_all uncomf_controls_all uncomf_fe_all uncomf_fe_controls_all using 03_tables/tabled13.tex, tex se replace  keep (cabine_use pp_dummy cabine_use_pp_dummy cs_dummy cabine_use_cs_dummy vox_dummy cabine_use_vox_dummy podemos_dummy cabine_use_up_dummy psoe_dummy cabine_use_psoe_dummy) coeflabels (cabine_use "Used a booth to vote" pp_dummy "Voted for PP" cabine_use_pp_dummy "Used booth x voted PP" cs_dummy "Voted for Ciudadanos" cabine_use_cs_dummy "Used booth x voted Ciudadanos" vox_dummy "Voted for Vox" cabine_use_vox_dummy "Used booth x voted Vox" podemos_dummy "Voted for Podemos" cabine_use_up_dummy "Used booth x voted Podemos" psoe_dummy "Voted for PSOE" cabine_use_psoe_dummy "Used booth x voted PSOE" ) star(* 0.10 ** 0.05 *** 0.01) s(Controls FE, label("Controls" "Region fixed effects")) nomtitles addnotes("Standard errors are robust" "The outcome variable is a dummy for whether each respondent showed" "signs of discomfort during the survey interview" "Models 2 and 4 include controls for income, education, age, age squared, size of" "respondent's municipality, and a dummy for respondents identifying as female") scalars(e(N))
